package com.imooc.poker_game_v2;

/**
 * 扑克牌类
 * 
 * @author Administrator
 */
public class Card implements Comparable<Card>{
	
	private int pointScore; // 手牌的点数
	private int colourScore; // 花色的点数
	private String points; // 牌的名称
	private String color; // 牌的花色
	
	public Card(int pointScore, int colourScore, String points, String color) {
		this.pointScore = pointScore;
		this.colourScore = colourScore;
		this.points = points;
		this.color = color;
	}
	
	/**
	 * 重写Comparable类中的compareTo()方法
	 * @param c
	 * @return
	 */
	@Override
	public int compareTo(Card c) {
		// 如果点数一样, 则比较花色
		if (this.pointScore == c.pointScore) {
			return c.colourScore - this.colourScore;
		}
		
		return c.pointScore - this.pointScore;
	}
	
	
	@Override
	public String toString() {
		return this.color + this.points;
	}
}
